package com.javajun.entity;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;

/**
 * @className: Invoice
 * @description: 发票的实体类
 * @author: JavaJun
 * @date: 2018年10月29日
 */
@Entity
public class Invoice {

    private Integer id;
    // 发票代码
    private String invoiceCode;
    // 发票号码
    private String invoiceNum;
    // 开票日期
    private Date invoiceDate;
    // 开票金额
    private Double invoiceMoney;
    // 发票状态
    private String invoiceState;
    // 申请报销日期
    private Date applyDate;
    // 报销人
    private String whoExpenses ;
    // 创建日期
    private Date creatDate;
    // 创建人
    private String creatUser;
    // 是否删除
    private Integer deleted;
    
    private Enterprise enterprise;
    
    @Id
    @GeneratedValue
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }    
    @Column(name="is_deleted")
    public Integer getDeleted() {
        return deleted;
    }
    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }
    @Column(unique=true)
    public String getInvoiceCode() {
        return invoiceCode;
    }
    public void setInvoiceCode(String invoiceCode) {
        this.invoiceCode = invoiceCode;
    }
    @Column(unique=true)
    public String getInvoiceNum() {
        return invoiceNum;
    }
    public void setInvoiceNum(String invoiceNum) {
        this.invoiceNum = invoiceNum;
    }

    public Double getInvoiceMoney() {
        return invoiceMoney;
    }
    public Date getInvoiceDate() {
        return invoiceDate;
    }
    public void setInvoiceDate(Date invoiceDate) {
        this.invoiceDate = invoiceDate;
    }
    public void setInvoiceMoney(Double invoiceMoney) {
        this.invoiceMoney = invoiceMoney;
    }
    public String getInvoiceState() {
        return invoiceState;
    }
    public void setInvoiceState(String invoiceState) {
        this.invoiceState = invoiceState;
    }
    public Date getApplyDate() {
        return applyDate;
    }
    public void setApplyDate(Date applyDate) {
        this.applyDate = applyDate;
    }
    public String getWhoExpenses() {
        return whoExpenses;
    }
    public void setWhoExpenses(String whoExpenses) {
        this.whoExpenses = whoExpenses;
    }
    public Date getCreatDate() {
        return creatDate;
    }
    public void setCreatDate(Date creatDate) {
        this.creatDate = creatDate;
    }
    public String getCreatUser() {
        return creatUser;
    }
    public void setCreatUser(String creatUser) {
        this.creatUser = creatUser;
    }
    @ManyToOne
    public Enterprise getEnterprise() {
        return enterprise;
    }
    public void setEnterprise(Enterprise enterprise) {
        this.enterprise = enterprise;
    }
    
    @Transient
    public String getInvoiceDateStr() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(invoiceDate);
    }
    
    @Transient
    public String getApplyDateStr() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        return sdf.format(applyDate);
    }
}
